home *** CD-ROM | disk | FTP | other *** search
- Path: STERLING.COM!Ross_Patterson
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Newsgroups: comp.lang.rexx
- Message-ID: <199601231455.JAA14589@mail.Reston.VMD.Sterling.COM>
- Date: Tue, 23 Jan 1996 10:25:13 EST
- Sender: REXX Programming discussion list <REXXLIST@uga.cc.uga.edu>
- From: Ross Patterson <Ross_Patterson@STERLING.COM>
- Subject: Re: This just HAS to be simple!
-
- Frank Merrow <fmerrow@WIZARD.QUALCOMM.COM> writes:
-
- >Except I cannot for the life of me figure out what to put at ???. sigl
- >isn't active (no value), sourceline() does the wrong thing. I even looked
- >at PARSE SOURCE, but this was no help. How do you get the current line
- >number?
-
- You can't. The only line-number reference in REXX is the contents of
- the special variable SIGL, which is set to the line-number from which
- control was diverted.
-
- > Even if I did involk a signal JUST to get the line number is
- >destroy's DO and such, put how do I get BACK?
-
- Try the CALL instruction. SIGL is set by SIGNAL, CALL and
- function-calls, so the following code does what you want:
-
- ...
- Call ErrorMessage 'Top of the world, Ma!'
- ...
- ErrorMessage: Say 'Error at line' SigL ||':' Arg(1)
- Return
-
- If you need a general-purpose line-number function, consider:
-
- Line = LineNumber()
- ...
- LineNumber: Return SigL
-
- The only caveat is that if the called routine begins with a PROCEDURE
- instruction, you must include SIGL in the EXPOSE list. SIGL is set
- in the context of the caller, so it exists before the called routine
- gets control, and will therefore be hidden by a PROCEDURE unless
- explicitly exposed.
-
- Ross Patterson
- Sterling Software, Inc.
- VM Software Division
-